package com.design.pattern.single;

/**
 * @author wangyingjie
 * @date
 * @remark 登记式单例/内部类单例
 */
public class StaticSingleton {

    /**
     * 静态内部类
     */
    private static class SingletonHolder{
        private static final StaticSingleton staticSingleton = new StaticSingleton();
    }

    private StaticSingleton() {
    }

    /**
     * StaticSingleton被装载的时候，不会实例化，因为SingletonHolder没有被调用，打到懒加载的作用
     * @return
     */
    public static StaticSingleton getInstance(){
        return SingletonHolder.staticSingleton;
    }
}
